const Mock = require('mockjs')
import { GetQueryString } from '../util';

const Random = Mock.Random

const noticeData = (options) => {
    let page = GetQueryString('page', options.url.split('?')[1])
    // console.log(page);
    let list = []
    for (let i = (page-1)*20; i < 20*page; i++) {
        let obj = Mock.mock({
            "tag|1": ['寄售公告', '空投公告', '活动公告', '合成公告', '上新公告', '澄清公告', '平台公告', 'iBox宇宙编年史', '系统公告', '赋能公告']
        })
        let item = {
            'id': i + 1,
            'tag': obj.tag,
            'title': `【${obj.tag != 'iBox宇宙编年史' ? 'ibox' : ''}${obj.tag}】`+ Random.ctitle(10, 20),
            'datetime': Random.datetime('yyyy-MM-dd HH:mm')
        }
        list.push(item)
    }
    return list
}

Mock.mock(RegExp('http://localhost:8080/api/notice'+'.*'), noticeData)